package com.boat.ai;

import com.boat.ai.domain.enums.FileTypeEnum;

public class FileTypeUtil {

    public static FileTypeEnum getFileType(String contentType) {
        return switch (contentType) {
            case "application/pdf" -> FileTypeEnum.PDF;
            case "text/markdown", "content/x-markdown" -> FileTypeEnum.MARKDOWN;
            case "text/plain" -> FileTypeEnum.TEXT;
            case "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ->
                    FileTypeEnum.EXCEL;
            default -> throw new IllegalArgumentException("未知的文件类型");
        };
    }
}
